/*
 * @Description: 充值vip弹窗
 * @Author: iamsmiling
 * @Date: 2021-06-10 08:47:02
 * @LastEditTime: 2021-06-10 09:18:55
 */

import 'package:credit_business_circle/R/R.dart';
import 'package:flutter/material.dart';

Future showVipDialog(BuildContext context,
    {required Function()? onCancel, required Function()? onConfirm}) {
  return showDialog(
      context: context,
      builder: (BuildContext context) {
        return TextButtonTheme(
          data: TextButtonThemeData(
              style: ButtonStyle(
                  padding: MaterialStateProperty.all(EdgeInsets.zero),
                  minimumSize:
                      MaterialStateProperty.all(Size.fromHeight(R.dimen.dp44)),
                  textStyle: MaterialStateProperty.all(TextStyle(
                      fontSize: R.dimen.sp15, color: R.color.ff049af9)),
                  foregroundColor:
                      MaterialStateProperty.all(R.color.ff049af9))),
          child: Dialog(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                Container(
                  margin: EdgeInsets.only(
                      top: R.dimen.dp24,
                      bottom: R.dimen.dp20,
                      left: R.dimen.dp20),
                  child: Text(
                    "提示：",
                    style: TextStyle(
                      fontSize: R.dimen.sp17,
                      color: R.color.ff222222,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(
                      left: R.dimen.dp20,
                      right: R.dimen.dp20,
                      bottom: R.dimen.dp30),
                  child: RichText(
                      text: TextSpan(
                          text: "普通用户只能选择常用语，自定义输入仅限VIP会员使用，",
                          style: TextStyle(
                              fontSize: R.dimen.sp12,
                              color: R.color.ff222222,
                              height: 1.5),
                          children: [
                        TextSpan(
                            text: "是否立即升级为VIP会员？",
                            style: TextStyle(color: R.color.ff08a376))
                      ])),
                ),
                Divider(
                  height: .5,
                ),
                SizedBox(
                  height: R.dimen.dp48,
                  child: Row(
                    children: [
                      Expanded(
                        child: TextButton(
                            onPressed: onCancel,
                            child: Text(
                              "关闭",
                              style: TextStyle(color: R.color.ff666666),
                            )),
                      ),
                      Container(
                        width: .5,
                        height: R.dimen.dp48,
                        color: R.color.ffdddddd,
                      ),
                      Expanded(
                        child: TextButton(
                            onPressed: onConfirm,
                            child: Text(
                              "去升级VIP会员",
                              style: TextStyle(color: R.color.ff049af9),
                            )),
                      )
                    ],
                  ),
                )
              ],
            ),
          ),
        );
      });
}
